package eclipse.client;
import javax.media.opengl.*;
import eclipse.lib.graphics.*;
/**
 *The GameLogic class handles the drawing of any higher-level Graphical objects.
 */
public class GameLogic
{
	/**
	 * Draws a player object to the OpenGL surface.
	 * @param gl OpenGL Object representing what is drawn.
	 */
	public static void drawPlayers(GL gl)
	{
		int spriteID = 0;
		int dir, frame;
		if(Database.player == null)
			return;
		for(int i = 0; i < Database.MAX_PLAYERS; i++)
		{
			spriteID 	= Database.player[i].character.cSprite;
			dir			= Database.player[i].character.cDir;
			frame		= Database.player[i].character.cFrame;
			gl.glPushMatrix();				
				gl.glTranslatef(
						Database.player[i].character.cPos.x,
						Database.player[i].character.cPos.y, 
						Database.player[i].character.cPos.z);
				GLPrimitives.drawSprite(gl, Database.tSpriteSheet[spriteID], frame, dir, 4);
			gl.glPopMatrix();
		}
	}
}
